package com.example.demo09redisbloom.controller;

import com.example.demo09redisbloom.service.RedisBloomService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Tag(name = "RedisBloom布隆过滤器")
@RestController
@RequestMapping("/bloom")
@Slf4j
public class RedisBloomController {
    @Resource
    private RedisBloomService redisBloomService;

    @Operation(summary = "RedisBloom布隆过滤器添加单个")
    @GetMapping(value = "/addOneKey")
    public Boolean addOneKey(String key) {
        return redisBloomService.addOneKey(key);
    }

    @Operation(summary = "RedisBloom布隆过滤器判断是否存在")
    @GetMapping(value = "/exits")
    public Boolean exits(String key) {
        return redisBloomService.exits(key);
    }
}